package com.lwj.controller;

import com.fasterxml.jackson.databind.annotation.JsonAppend;
import com.lwj.entity.Progress;
import com.lwj.model.PlaneList;
import com.lwj.service.ProgressService;
import com.lwj.util.DataRet;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author linwj
 * @date 2018/5/12 14:37
 */

@RestController
@RequestMapping("/plane")
public class PlaneController {

    @Autowired
    private ProgressService progressService;

    /**
     * 制定项目计划
     * @param planeList
     * @param projectId
     * @return
     */
    @PostMapping("/create")
    public DataRet<String> makePlane(PlaneList planeList,int projectId){
        return progressService.makePlane(planeList,projectId);
    }

    /**
     * 获取项目计划
     * @param projectId
     * @return
     */
    @PostMapping("")
    public DataRet<List<Progress>> getPlaneProgress(int projectId){
        return progressService.getPlaneProgress(projectId);
    }

    /**
     * 修改某一步计划的状态 未完成/已完成
     * @param progressId
     * @return
     */
    @PostMapping("/status")
    public DataRet<String> changeProgressStatus(int progressId){
        return progressService.changeProgressStatus(progressId);
    }
}
